package com.sxkiler.demo.adaptor;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component("testAdaptor")
public class TestAdaptor {

    volatile int countIndex = 0;
    volatile int sleepIndex = 0;
    static Logger logger = LoggerFactory.getLogger(TestAdaptor.class);
    public void sleep(Map paramMap)throws Exception{
        Long sleepTime = NumberUtil.parseLong(paramMap.get("sleepTime").toString());
        String id = paramMap.get("id").toString();
        System.out.println(id+"_"+(++countIndex));
        if(sleepTime>1000){
            System.out.println(id+"_"+(++sleepIndex)+"_"+sleepTime);
        }
        long inx = sleepTime/1000;
        for(int i=0;i<inx;i++){
            Thread.sleep(1000);
            System.out.println(id+"_"+sleepTime);
        }
    }
}
